{__NOLAYOUT__}
<layout name="no_nav" />

<style type="text/css">
body{
	background-color:#eee;
}
.menu-list-item-adv:after {
	border:0px;
}
.withdraw-container {
	width:100%;
	height:100%;
	padding-top:2em;
	padding:1em 0.1em 0em 0.1em;
}
.menu-list-title {
	float: left;
}
.right-block {
	float: right;
	margin-right: 1.5em;
}
.input-withdraw {
	border: 1px solid #bbb;
	border-radius: 0.1em;
	width: 5.5em;
	height: 100%;
}
.linkButton{
	color:#008;
}
</style>

<!-- TOPBAR -->
<header class="top-bar flex-row">
  <a class="row-item row-item-auto top-bar-back" href="{:U('DisShop/myBonus', 'sid='.$sid)}">返回</a>
  <h3 class="row-item top-bar-name">订单查询</h3>
  <span class="row-item row-item-auto top-bar-menu"></span>
</header>

<div class="withdraw-container">
	<form method="post" action="saveDeliverAddressPost" id="form" class="form">
		<section class="lists">
		    <empty name="user['defaultBank']">
				<span class="lists-item lists-item-link" href="javascript:void(0)">
				     <p class="menu-list-title">提现银行卡</p>
				     <div class="right-block">
				     	<a href="{:U('DisShop/addBank', 'sid='.$sid)}?back={$backUrl}" class="linkButton">添加银行</a>
				     </div>
				</span>
		    <else/>
				<a class="lists-item lists-item-link" href="{:U('DisShop/myBankList', 'sid='.$sid)}?back={$backUrl}&mode=sel">
					 <p class="menu-list-title">提现银行卡</p>
				     <div class="right-block">
				     	{$user['defaultBank']['bankName']}({$user['defaultBank']['lastCode']})
				     </div>
				     <input type="hidden" name="bankId" value="{$user['defaultBank']['bankId']}">
				</a>
		    </empty>
			<a class="lists-item lists-item-link menu-list-item-adv" href="javascript:void(0)">
			     <p class="menu-list-title">可提现积分</p>
			     <div class="right-block" style="color:#ff6900;font-weight: bold;">{$user['withdrawable']}</div>
			</a>
			<a class="lists-item lists-item-link menu-list-item-adv" href="javascript:void(0)">
			     <p class="menu-list-title">提现积分</p>
			     <div class="right-block">
					<input name="money" value="" class="input-withdraw" data-nullmsg="请输入提现积分"/>
				 </div>
			</a>
		</section>
		<div class="form-item" style="margin:.5em">
			<input type="hidden" name="sid" value="{$sid}" />
			<button class="btn btn-orange w100" id="btnWithDraw">确认提现</button>
		</div>
	</form>
</div>


<script type="text/javascript">
  $(function() {
	
    $("#form").on("submit", function(e) {
      e.preventDefault();
      APP.checkForm(this, postAddress);
    });

    function postAddress() {
      var data = $(this).serializeArray();
      $.post("__CONTROLLER__/withdrawPost", data, function(response) {
        if ( response.error === 0 ) {
        	APP.alert(response.msg);
        	setTimeout(function() {
        		location.href = "{:U('DisShop/myBonus', 'sid='.$sid)}";
        	}, 1000);
        } else {
        	APP.alert(response.msg);
        }
      });
    };

  });
</script>
